/*
Copyright (C) 1997-2001 Id Software, Inc.

This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  

See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
*/

// Created on 13.01.2004 by RST.
// $Id: client_t.java,v 1.2 2004/08/22 14:25:13 salomo Exp $
using System;
using Suake2.UI;
using Suake2.UI.client;
using Suake2.UI.game;
using Suake2.UI.qcommon;
using Suake2.UI.render;
using Suake2.UI.server;
namespace Suake2.UI.server
{
	
	public class client_t
	{
		private void  InitBlock()
		{
			datagram_buf = new sbyte[Defines.MAX_MSGLEN];
			frames = new client_frame_t[Defines.UPDATE_BACKUP];
		}
		
		public client_t()
		{
			InitBlock();
			for (int n = 0; n < Defines.UPDATE_BACKUP; n++)
			{
				frames[n] = new client_frame_t();
			}
		}
		
		public const int LATENCY_COUNTS = 16;
		public const int RATE_MESSAGES = 10;
		
		internal int state;
		
		internal System.String userinfo = "";
		
		internal int lastframe; // for delta compression
		internal usercmd_t lastcmd = new usercmd_t(); // for filling in big drops
		
		internal int commandMsec; // every seconds this is reset, if user
		// commands exhaust it, assume time cheating
		
		internal int[] frame_latency = new int[LATENCY_COUNTS];
		internal int ping;
		
		internal int[] message_size = new int[RATE_MESSAGES]; // used to rate drop packets
		internal int rate;
		internal int surpressCount; // number of messages rate supressed
		
		// pointer
		internal edict_t edict; // EDICT_NUM(clientnum+1)
		
		//char				name[32];			// extracted from userinfo, high bits masked
		internal System.String name = ""; // extracted from userinfo, high bits masked
		
		internal int messagelevel; // for filtering printed messages
		
		// The datagram is written to by sound calls, prints, temp ents, etc.
		// It can be harmlessly overflowed.
		internal sizebuf_t datagram = new sizebuf_t();
		//UPGRADE_NOTE: The initialization of  'datagram_buf' was moved to method 'InitBlock'. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1005'"
		internal sbyte[] datagram_buf;
		
		//UPGRADE_NOTE: The initialization of  'frames' was moved to method 'InitBlock'. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1005'"
		internal client_frame_t[] frames; // updates can be delta'd from here
		
		internal sbyte[] download; // file being downloaded
		internal int downloadsize; // total bytes (can't use EOF because of paks)
		internal int downloadcount; // bytes sent
		
		internal int lastmessage; // sv.framenum when packet was last received
		internal int lastconnect;
		
		internal int challenge; // challenge of this user, randomly generated
		
		internal netchan_t netchan = new netchan_t();
		
		//this was introduced by rst, since java can't calculate the index out of the address.
		internal int serverindex;
	}
}